package com.lee.bemorebetter.degin.principle;

/**
 * @author ：liylw
 * @date ：Created in 2021/3/25 19:05
 */
public class Demo {
    public static void main(String[] args) {
        MetricsStorage storage = new RedisMetricsStorage();
        ConsoleReporter consoleReporter = new ConsoleReporter(storage);
        consoleReporter.startRepeatedReport(60,60);

        EmailReporter emailReporter = new EmailReporter(storage);
        emailReporter.addToAddress("1111@www.com");
        emailReporter.startDailyReport();

        MetricsCollector collector = new MetricsCollector(storage);
        collector.recordRequest(new RequestInfo("register",123,10234));
        collector.recordRequest(new RequestInfo("register",223,11234));
        collector.recordRequest(new RequestInfo("register",323,12334));
        collector.recordRequest(new RequestInfo("login",23,12423));
        collector.recordRequest(new RequestInfo("login",1223,14234));

        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }
}
